package com.briup.oagg.model.web.controller;

import com.briup.framework.utils.web.Response;
import com.briup.oagg.model.service.IPreprocessOperatorService;
import com.briup.oagg.model.web.vm.PreprocessOperatorVM;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 预处理算子信息 前端控制器
 *
 * @author briup
 */
@Api(tags = "2.预处理算子管理")
@RestController
@RequestMapping("/preprocess")
public class PreprocessOperatorController {
    @Autowired
    private IPreprocessOperatorService service;

    @ApiOperation(value = "根据编号查询预处理算子信息")
    @ApiImplicitParam(name = "preprocessId",value = "预处理算子编号",paramType = "path")
    @GetMapping("/{preprocessId}")
    public Response<PreprocessOperatorVM> findById(@PathVariable String preprocessId){
        PreprocessOperatorVM vm = service.findById(preprocessId);
        return Response.success(vm);
    }

    @ApiOperation(value = "查询所有预处理算子信息")
    @GetMapping
    public Response<List<PreprocessOperatorVM>> findAll(){
        List<PreprocessOperatorVM> list = service.findAll();
        return Response.success(list);
    }
}
